/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kenny.wiki.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "title", catalog = "wiki", schema = "")
@NamedQueries({
    @NamedQuery(name = "Title.findAll", query = "SELECT t FROM Title t"),
    @NamedQuery(name = "Title.findByTitleId", query = "SELECT t FROM Title t WHERE t.titleId = :titleId"),
    @NamedQuery(name = "Title.findByCategoryId", query = "SELECT t FROM Title t WHERE t.categoryId = :categoryId"),
    @NamedQuery(name = "Title.findByUserId", query = "SELECT t FROM Title t WHERE t.userId = :userId"),
    @NamedQuery(name = "Title.findByTitleName", query = "SELECT t FROM Title t WHERE t.titleName like :titleName"),
    @NamedQuery(name = "Title.findByTitleTime", query = "SELECT t FROM Title t WHERE t.titleTime = :titleTime"),
    @NamedQuery(name = "Title.findByTitleView", query = "SELECT t FROM Title t WHERE t.titleView = :titleView"),
    @NamedQuery(name = "Title.findByTitleEdit", query = "SELECT t FROM Title t WHERE t.titleEdit = :titleEdit"),
    @NamedQuery(name = "Title.findByTitleIntro", query = "SELECT t FROM Title t WHERE t.titleIntro = :titleIntro"),
    @NamedQuery(name = "Title.findByTitlePhoto", query = "SELECT t FROM Title t WHERE t.titlePhoto = :titlePhoto")})
public class Title implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "title_id", nullable = false)
    private Integer titleId;
    @Basic(optional = false)
    @Column(name = "category_id", nullable = false)
    private int categoryId;
    @Basic(optional = false)
    @Column(name = "user_id", nullable = false)
    private int userId;
    @Basic(optional = false)
    @Column(name = "title_name", nullable = false, length = 50)
    private String titleName;
    @Basic(optional = false)
    @Column(name = "title_time", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date titleTime;
    @Basic(optional = false)
    @Column(name = "title_view", nullable = false)
    private int titleView;
    @Basic(optional = false)
    @Column(name = "title_edit", nullable = false)
    private int titleEdit;
    @Basic(optional = false)
    @Column(name = "title_intro", nullable = false, length = 500)
    private String titleIntro;
    @Column(name = "title_photo", length = 100)
    private String titlePhoto;

    public Title() {
    }

    public Title(Integer titleId) {
        this.titleId = titleId;
    }

    public Title(Integer titleId, int categoryId, int userId, String titleName, Date titleTime, int titleView, int titleEdit, String titleIntro) {
        this.titleId = titleId;
        this.categoryId = categoryId;
        this.userId = userId;
        this.titleName = titleName;
        this.titleTime = titleTime;
        this.titleView = titleView;
        this.titleEdit = titleEdit;
        this.titleIntro = titleIntro;
    }

    public Integer getTitleId() {
        return titleId;
    }

    public void setTitleId(Integer titleId) {
        this.titleId = titleId;
    }

    public int getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(int categoryId) {
        this.categoryId = categoryId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getTitleName() {
        return titleName;
    }

    public void setTitleName(String titleName) {
        this.titleName = titleName;
    }

    public Date getTitleTime() {
        return titleTime;
    }

    public void setTitleTime(Date titleTime) {
        this.titleTime = titleTime;
    }

    public int getTitleView() {
        return titleView;
    }

    public void setTitleView(int titleView) {
        this.titleView = titleView;
    }

    public int getTitleEdit() {
        return titleEdit;
    }

    public void setTitleEdit(int titleEdit) {
        this.titleEdit = titleEdit;
    }

    public String getTitleIntro() {
        return titleIntro;
    }

    public void setTitleIntro(String titleIntro) {
        this.titleIntro = titleIntro;
    }

    public String getTitlePhoto() {
        return titlePhoto;
    }

    public void setTitlePhoto(String titlePhoto) {
        this.titlePhoto = titlePhoto;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (titleId != null ? titleId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Title)) {
            return false;
        }
        Title other = (Title) object;
        if ((this.titleId == null && other.titleId != null) || (this.titleId != null && !this.titleId.equals(other.titleId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.kenny.wiki.ejb.entity.Title[titleId=" + titleId + "]";
    }

}
